# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=rinutils
pkgver=0.4.1
pkgrel=0
pkgdesc="C11 / gnu11 utilities C library"
url="https://www.shlomifish.org/open-source/projects/"
arch="noarch"
license="MIT"
makedepends="cmake perl cmocka-dev"
checkdepends="perl-dev perl-env-path perl-inline perl-inline-c
	perl-parse-recdescent perl-path-tiny perl-string-shellquote
	perl-test-differences perl-utils"
subpackages="$pkgname-dev"
source="https://github.com/shlomif/rinutils/releases/download/$pkgver/rinutils-$pkgver.tar.xz"
options="!check" # Requires unavailable perl modules Test::TrainlingSpace module

build() {
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
}

sha512sums="e175e5ce6e32e85d4102ba788c5dec40bd09ecd4002e6de10e726843b7ac562a63b305898061cab623eb85d46983ae777ac6b57c46194a29d78f0fe498fa63e7  rinutils-0.4.1.tar.xz"
